﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Polaris.Domain.Model.Dto.Sys_Menu.Response
{
    public class MenuNode()
    {
        /// <summary>
        /// 父级id null代表顶级菜单
        /// </summary>
        public string ParentID { get; set; }

        /// <summary>
        /// id
        /// </summary>
        public string Id { get; set; }

        /// <summary>
        /// 菜单名称
        /// </summary>
        public string Label { get; set; }

        /// <summary>
        /// 菜单类型
        /// </summary>
        public int MenuType { get; set; }

        /// <summary>
        /// 图标
        /// </summary>
        public string MenuIcon { get; set; }

        /// <summary>
        /// 页面路径
        /// </summary>
        public string PageUrl { get; set; }

        /// <summary>
        /// 路由
        /// </summary>
        public string Router { get; set; }

        /// <summary>
        /// 排序
        /// </summary>
        public int Sort { get; set; }

        /// <summary>
        /// 子级
        /// </summary>
        public List<MenuNode> Children { get; set; }

        /// <summary>
        /// 深拷贝方法
        /// </summary>
        /// <returns></returns>
        public MenuNode Clone()
        {
            return new MenuNode
            {
                Id = this.Id,
                ParentID = this.ParentID,
                Label = this.Label,
                MenuType = this.MenuType,
                MenuIcon = this.MenuIcon,
                PageUrl = this.PageUrl,
                Router = this.Router,
                Sort = this.Sort,
                Children = new List<MenuNode>() // 新建空列表
            };
        }
    }
}
